widget: Remove gtk_widget_draw()
authorBenjamin Otte <otte@redhat.com>
Mon, 2 Apr 2018 06:28:34 +0000 (08:28 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 5 Apr 2018 12:56:39 +0000 (14:56 +0200)
If you want to draw a widget to cairo today, you create a widget
paintable, snapshot it to a render node and then draw the render node to
cairo.

And yes, this is that complicated on purpose. Don't draw widgets to
Cairo.

docs/reference/gtk/gtk4-sections.txt
gtk/gtkwidget.c
gtk/gtkwidget.h

index be2b93509b15521c2da189b898d448f80a7ace7d..5417c28c78f7853c72945e7e49f4637435ee81c2 100644 (file)
@@ -4238,7 +4238,6 @@ gtk_widget_map
 gtk_widget_unmap
 gtk_widget_realize
 gtk_widget_unrealize
-gtk_widget_draw
 gtk_widget_queue_draw
 gtk_widget_queue_resize
 gtk_widget_queue_resize_no_redraw
index 2aad2c8fa573ef7971878f8fc602648ceff99953..d3d60fa51a2e2b354c6ad1a71c1d2a2708098985 100644 (file)
@@ -5379,46 +5379,6 @@ gtk_widget_draw_internal (GtkWidget *widget,
     }
 }
 
-/**
- * gtk_widget_draw:
- * @widget: the widget to draw. It must be drawable (see
- *   gtk_widget_is_drawable()) and a size must have been allocated.
- * @cr: a cairo context to draw to
- *
- * Draws @widget to @cr. The top left corner of the widget will be
- * drawn to the currently set origin point of @cr.
- *
- * You should pass a cairo context as @cr argument that is in an
- * original state. Otherwise the resulting drawing is undefined. For
- * example changing the operator using cairo_set_operator() or the
- * line width using cairo_set_line_width() might have unwanted side
- * effects.
- * You may however change the context’s transform matrix - like with
- * cairo_scale(), cairo_translate() or cairo_set_matrix() and clip
- * region with cairo_clip() prior to calling this function. Also, it
- * is fine to modify the context with cairo_save() and
- * cairo_push_group() prior to calling this function.
- *
- * Note that special-purpose widgets may contain special code for
- * rendering to the screen and might appear differently on screen
- * and when rendered using gtk_widget_draw().
- **/
-void
-gtk_widget_draw (GtkWidget *widget,
-                 cairo_t   *cr)
-{
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (!widget->priv->alloc_needed);
-  g_return_if_fail (!widget->priv->alloc_needed_on_child);
-  g_return_if_fail (cr != NULL);
-
-  cairo_save (cr);
-
-  gtk_widget_draw_internal (widget, cr);
-
-  cairo_restore (cr);
-}
-
 static gboolean
 gtk_widget_real_key_press_event (GtkWidget         *widget,
                                 GdkEventKey       *event)
index d59e735eb55887db3c77e5b4915ae2aa2a7f9e4d..bac9e4d8c31da3c0cce9105a38d39ea7a5c6c4e3 100644 (file)
@@ -408,9 +408,6 @@ void       gtk_widget_realize             (GtkWidget           *widget);
 GDK_AVAILABLE_IN_ALL
 void       gtk_widget_unrealize           (GtkWidget           *widget);
 
-GDK_AVAILABLE_IN_ALL
-void       gtk_widget_draw                (GtkWidget           *widget,
-                                           cairo_t             *cr);
 /* Queuing draws */
 GDK_AVAILABLE_IN_ALL
 void       gtk_widget_queue_draw          (GtkWidget           *widget);